define(['../../../../js/lib/other/sweet-alert'],function() {
    return ['$scope','$location', '$interval','$timeout','bizProxy', function($scope,$location,$interval,$timeout,bizProxy) {
    	$scope.$emit("top-show",'false');//顶部隐藏
    	$scope.$emit('menuTypeLight','case_src_lib'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','22'); 	//显示底部文字
        
    	
    	getProxyData();
    	//点击返回首页
    	$scope.goHome = function(){
    		$scope.$emit("goNext","/");
    	}
    	
    	//点击查看进度
    	$scope.checkProgress = function(){
    		if(transData.userType === "1"){
    			// $scope.$emit("goNext","/mineLs");
                $scope.$emit("goNext","/myCaseList/00");
    		}else{
    			$scope.$emit("goNext","/minePt");
    		}
    	}
    	
    	//点击显示案件概况
    	$scope.goCaseProfile = function(id){
    		if(id != "" && id != null){
    			caseDetailInfo(id);
    		}
    	}

        //案源详细信息
        function caseDetailInfo(id){
            $scope.$emit("loadingChange",true);
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum =  '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.caseId = id;
            bizProxy.queryProxyBizData("queryCaseInfoDetail",headerInfo,bizInfo,
                function(tempData){
                    console.log(JSON.parse(tempData.body))
                    $timeout(function(){
                        $scope.$emit('loadingChange', false);
                        resultData.caseDetailData = "";
                        resultData.caseDetailData = JSON.parse(tempData.body);
                        $scope.$emit('goNext',"/caseProfile");
                    },0);
                },function(data){
                    $scope.$emit('loadingChange', false);
                    $scope.$emit("promptAlertMsg",data);
                    $scope.$emit("showCollect",true);
                    $timeout(function(){
                        $scope.$emit("showCollect",false);
                    },transData.promptTime);
                });

        }
    	
    	//获取代理接口数据(案件列表)
    	function getProxyData(){
        	var headerInfo = {},bizInfo = {};
        	headerInfo.pageNum = '1';
        	headerInfo.pageSize = '1000';
        	headerInfo.sessionId = transData.sessionId;
        	
    		$scope.$emit("loadingChange",true);
    		bizProxy.queryProxyBizData("matchCaseList",headerInfo,bizInfo,
    				function(tempData){//SUCCESS
						console.log(JSON.parse(tempData.body))
		    			if(tempData.body != "" && tempData.body != null && tempData.body != "[]"){
							var tempCaseList = JSON.parse(tempData.body).caseInfoList;
							$timeout(function(){
								$scope.tempCaseList = tempCaseList;
								$scope.$emit("loadingChange",false);
							},0);
						}else{
							$timeout(function(){
								$scope.tempCaseList = "";
								$scope.$emit("loadingChange",false);
							},0);
						}
		    		},function(data){//FAIL
		    			$timeout(function(){
							$scope.tempCaseList = "";
							$scope.$emit("loadingChange",false);
						},0);
		    		});
    	}
    	
    	
        $scope.$apply();
    }];
});